package com.wisemoresystem.seal.action.useapply.search;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.wisemoresystem.seal.base.action.ProjBaseAction;
import com.wisemoresystem.seal.model.t_use_search_error;
import com.wisemoresystem.seal.service.UseSearchErrorService;
import com.wisemoresystem.seal.util.DateTools;
import com.wisemoresystem.seal.web.WebTools;

/**
 * 用印异常列表 和用印异常处理列表
 * 
 * @author Administrator
 *
 */
@Controller("ixUseError")
@Scope("prototype")
@RequestMapping("/ix/useapply/search/error")
public class UseErrorAction extends ProjBaseAction {

	@Autowired
	private UseSearchErrorService uService;
	
	// 异常处理列表
	@RequestMapping("/list")
	public ModelAndView list(String srh_reason, String srh_name) {

		List<Map<String, Object>> list = uService.selectUseSealErrorList(
				srh_reason, srh_name, page);

		ModelAndView mv = new ModelAndView(
				"/jsp/useapply/search/error/list");
		mv.addObject("list", list);
		return mv;
	}
	
	// 异常列表
	@RequestMapping("/error_list")
	public ModelAndView error_list(String srh_reason, String srh_name) {

		List<Map<String, Object>> list = uService.selectUseSealErrorManList(
				srh_reason, srh_name, page);

		ModelAndView mv = new ModelAndView(
				"/jsp/useapply/search/error/error_list");
		mv.addObject("list", list);
		return mv;
	}
	
	@RequestMapping("/error")
	public ModelAndView error(t_use_search_error error) {

		error.setBank_id(WebTools.getCurrentBankId());
		error.setUser_id(WebTools.getCurrentUserId());
		error.setE_time(DateTools.getTimestampTodayStr());
		oc.saveObj(error);

		ModelAndView mv = new ModelAndView("redirect:list.htm");
		return mv;
	}
}
